<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:p="http://primefaces.org/ui">
    <ui:composition template="../TemplateAdmin.xhtml">
        <ui:define name="title">
            <h:outputText value="Project Deatil"></h:outputText>
        </ui:define>       
        <ui:define name="body">
            <h:form>
                <p:panel>
                    <h:panelGrid columns="2" >
                        <h:outputText value="Project ID :"/>
                        <h:outputText value="#{projectController.selected.prID}" title="ProjectID"/>
                        <h:outputText value="Order ID :"/>
                        <h:outputText value="#{projectController.selected.odID.odID}" title="OrderID"/>                
                        <h:outputText value="State :"/>
                        <h:outputText value="#{projectController.selected.prState}" title="State"/> 
                        <h:outputText value="URL Image :"/>
                        <h:outputText value="#{projectController.selected.pdImageURL}" title="URLImage"/> 
                        <h:outputText value="Created Date :"/>
                        <h:outputText value="#{projectController.selected.prCreated}" title="Created Date"> 
                            <f:convertDateTime pattern="MM/dd/yyyy " />
                        </h:outputText>
                        <h:outputText value="Completed Date :"/>
                        <h:outputText value="#{projectController.selected.prCompleted}" title="Completed Date"> 
                            <f:convertDateTime pattern="MM/dd/yyyy " />
                        </h:outputText>

                        <h:outputText value="ManagerID :"/>
                        <h:outputText value="#{projectController.selected.mnID}" title="ManagerID"/>
                        <h:outputText value="ManagerName"/>
                        <p:commandLink id="ManagerDetail" value="#{projectController.selected.mnID.mnName}" title="ManagerID" />                
                    </h:panelGrid>

                </p:panel>
                <p:overlayPanel id="DetailsManagerPanel" for="ManagerDetail" hideEffect="fade" dynamic="true">  
                    <h:panelGrid columns="2" >
                        <h:outputText value="ID :"/>
                        <h:outputText value="#{projectController.selected.mnID.mnID}" title="ID"/>
                        <h:outputText value="Name :"/>
                        <h:outputText value="#{projectController.selected.mnID.mnName}" title="Name"/>
                        <h:outputText value="UserName"/>
                        <h:outputText value="#{projectController.selected.mnID.mnUserName}" title="UserName"/>
                        <h:outputText value="Email :"/>
                        <h:outputText value="#{projectController.selected.mnID.mnEmail}" title="Email"/>
                        <h:outputText value="Address :"/>
                        <h:outputText value="#{projectControllerr.selected.mnID.mnAdress}" title="Address"/>
                        <h:outputText value="Phone :"/>
                        <h:outputText value="#{projectController.selected.mnID.mnPhone}" title="Phone"/>  
                        <h:outputText value="Permission :"/>
                        <h:outputText value="#{projectController.selected.mnID.mnPermission}" title="Permission"/>   
                    </h:panelGrid>
                </p:overlayPanel> 
                <br />
                <br />
            </h:form>
            <h:form id="form2">
                <h:panelGroup>
                    <p:growl id="messages" showDetail="true"/>
                    <p:dataTable id="dataTable" var="item" value="#{projectController.selected.tblProjectDetailList}" editable="true"
                                 paginator="true" rows="5" paginatorPosition="bottom" resizableColumns="true"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                 rowsPerPageTemplate="5,10,15" style="width: 100%" widgetVar="projectDetailTable">	
                        <f:facet name="header">
                            <h:outputText value="ProjectDetail"/>
                        </f:facet>
                        <p:ajax event="rowEdit" listener="#{projectDetailController.onEdit}" update=":form2:messages"/>
                        <p:ajax event="rowEditCancel" listener="#{projectDetailController.onEditCancel}" />
                        <p:column sortBy="#{item.tblProject.prID}" headerText="Project ID" >                    
                            <p:cellEditor> 
                                <f:facet name="output">  
                                    <h:outputText value="#{item.tblProject.prID}"/>                          
                                </f:facet>
                                <f:facet name="input">  
                                    <h:outputText value="#{item.tblProject.prID}"/> 
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column sortBy="#{item.tblProjectDetailPK.pdNo}" headerText="Project No" >                    
                            <p:cellEditor> 
                                <f:facet name="output">  
                                    <h:outputText value="#{item.tblProjectDetailPK.pdNo}"/>                          
                                </f:facet>
                                <f:facet name="input">  
                                    <h:outputText value="#{item.tblProjectDetailPK.pdNo}"/> 
                                </f:facet>
                            </p:cellEditor>
                        </p:column>

                        <p:column sortBy="#{item.tblElevation.elName}" headerText="Elevation" >
                            <p:cellEditor> 
                                <f:facet name="output">  
                                    <h:outputText value="#{item.tblElevation.elName}"/>
                                </f:facet>
                                <f:facet name="input">  
                                    <h:outputText value="#{item.tblElevation.elID}"/>                                 
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column  headerText="Working Name">
                            <p:cellEditor>  
                                <f:facet name="output">  
                                    <h:outputText value="#{item.wkID.wkName}"/>
                                </f:facet>
                                <f:facet name="input">  
                                    <p:selectOneMenu id="wkID" value="#{item.wkID}">               
                                        <f:selectItems value="#{workingController.itemsAvailableSelectOne}"/>
                                    </p:selectOneMenu>
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column style="width:6%">  
                            <p:rowEditor />  
                        </p:column> 
                    </p:dataTable>
                </h:panelGroup>
                <br/>
                <br/>
           
            </h:form>
        </ui:define>
    </ui:composition>
</html>

